""""""
"""
    1.部分代码体出现次数较多，可以优化为一行
        assert r.json()["status"] == regist_success_file_data["exp"]["status"]
        assert r.json()["code"] == regist_success_file_data["exp"]["code"]
        assert r.json()["msg"] == regist_success_file_data["exp"]["msg"]
    2. 使用pytest_check代替assert避免断言失败后，后面语句执行不到
    
"""

import pytest_check

def equal(real,exp,keys=["status","code","msg"]):
    # 遍历每一个要比较的键

    for k in keys:
        r = str(real[k])
        e = str(exp[k])
        if pytest_check.equal(r,e):
            print("校验",k,"成功，实际结果为：",r,"预期结果为：",e)
        else:
            print("校验",k,"失败，实际结果为：",r,"预期结果为：",e)

